package com.code2roc.jarmanage.db;

import com.code2roc.jarmanage.model.FireWallRuleDO;
import com.code2roc.jarmanage.util.CommonUtil;
import com.code2roc.jarmanage.util.DataBaseUtil;

import java.util.List;

public class FireWallRuleDB {
    public static void insert(FireWallRuleDO entity) {
        entity.setRuleID(CommonUtil.getNewGuid());
        DataBaseUtil.insert("FireWallRule", entity);
    }

    public static void delete(String ruleID) {
        DataBaseUtil.executeSQL("delete from FireWallRule where ruleID='" + ruleID + "'");
    }

    public static void update(FireWallRuleDO entity) {
        DataBaseUtil.update("FireWallRule", entity, "ruleID");
    }

    public static FireWallRuleDO selectOne(String ruleID) {
        return DataBaseUtil.selectOne(FireWallRuleDO.class, "FireWallRule", "ruleID", ruleID);
    }

    public static List<FireWallRuleDO> selectList(String where) {
        return DataBaseUtil.selectList(FireWallRuleDO.class, "FireWallRule", where);
    }
}
